<template>
  <div>
    <h1>子组件</h1>
    <h1>子组件的数据:{{ n1 }}---{{ n2 }}</h1>
    <button @click="add">数据加一</button>
  </div>
</template>

<script>
export default {
  props: {
    n1: {
      type: Number,
      required: true
    },
    n2: {
      type: Number,
      required: true
    }

  },
  data() {
    return {

    }
  },
  mounted() {

  },
  methods: {
    add() {
      this.$emit('update:n1', this.n1 + 1)
      this.$emit('update:n2', this.n2 + 1)
    }
  }
}

</script>
<style scoped lang='less'>
</style>
